package com.cyy.demo.common;

import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;

/**
 * 返回给前端的同一个格式
 * @author admin
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Result implements Serializable {

    private static final long serialVersionUID = 4935648179189854443L;
    private int code = 200;

    private String msg = "success";

    private Object data;


    public Result(Object data) {
        super();
        this.data = data;
    }

    public String toJson(){
        return JSON.toJSONString(this);
    }



}
